
ChatCommands = {}
function AddCom(name, func)
Com = {}
Com.Name = name
Com.Func = func
table.insert(ChatCommands, Com)
end
AddCom("Test", function(ply) ply:PrintMessage(3, "Test") end)
hook.Add("PlayerSay", "TestHook", function(ply, text)
for k,v in pairs(ChatCommands) do
if(string.lower(string.sub(text, 1, string.len(v.Name))) == string.lower(v.Name)) then
v.Func(ply)
end
end
end)

function SGTEAM(name, func)
Com = {}
Com.Name = name
Com.Func = func
table.insert(ChatCommands, Com)
end
AddCom("/sg", function(ply) ply:SetTeam( SG_TEAM ) end)

function SETWRAITH(name, func)
Com = {}
Com.Name = name
Com.Func = func
table.insert(ChatCommands, Com)
end
AddCom("/wraith", function(ply) ply:SetTeam( WRAITH ) end)

function SETGENII(name, func)
Com = {}
Com.Name = name
Com.Func = func
table.insert(ChatCommands, Com)
end
AddCom("/genii", function(ply) ply:SetTeam( GENII ) end)

function SETREP(name, func)
Com = {}
Com.Name = name
Com.Func = func
table.insert(ChatCommands, Com)
end
AddCom("/replicator", function(ply) ply:SetTeam( REPLICATOR ) end)

function Kill(name, func)
Com = {}
Com.Name = name
Com.Func = func
table.insert(ChatCommands, Com)
end
AddCom("/kill", function(ply) ply:Kill() end)

function Leave(name, func)
Com = {}
Com.Name = name
Com.Func = func
table.insert(ChatCommands, Com)
end
AddCom("/leave", function() RunConsoleCommand( "disconnect" ) end)

function RemoveAll(name, func)
Com = {}
Com.Name = name
Com.Func = func
table.insert(ChatCommands, Com)
end
AddCom("/removeall", function() RunConsoleCommand( "gmod_cleanup" ) end)

